package com.mmz.curator;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.NodeCache;

public class CuratorEventDemo {
    static CuratorFramework curatorFramework=CuratorClientUtils.getInstance();

    public static void main(String[] args) throws Exception {
         NodeCache cache=new NodeCache(curatorFramework,"/curatorasd",false);
        cache.start(true);

        cache.getListenable().addListener(()-> System.out.println("节点数据发生变化,变化后的结果" +
                "："+new String(cache.getCurrentData().getData())));

        curatorFramework.create().forPath("/curatorasd","菲菲".getBytes());
        Thread.sleep(1000);
    }
}
